package utils

import (
	"fmt"
	"strings"
)

var StringUtil = &StringUtilTool{}

type StringUtilTool struct{}

func (*StringUtilTool) IsEmpty(str string) bool {
	if len(str) > 0 {
		return false
	}
	return true
}

func (*StringUtilTool) Substring(s string, length int) string {
	if len(s) <= length {
		return s
	}
	return s[:length]
}

func (*StringUtilTool) Format(format string, args ...interface{}) string {
	return fmt.Sprintf(format, args)
}
func (*StringUtilTool) FirstLetterToLower(s string) string {
	if len(s) == 0 {
		return s
	}
	first := strings.ToLower(string(s[0]))
	if len(s) == 1 {
		return first
	}
	return first + s[1:]
}
